<template>
  <div>
    <h1>送货管理</h1>
    <!--表格-->
    <el-table :data="orderList" border style="width: 100%">
      <el-table-column prop="id" label="订单号"/>
      <el-table-column prop="receiver" label="收货人"/>
      <el-table-column prop="phone" label="收货人电话"/>
      <el-table-column prop="total" label="订单总价"/>

      <el-table-column label="操作">
        <template #default="scope">
          <el-button  size="small" @click="complete(scope.row.id)">
            结账
          </el-button>
        </template>
      </el-table-column>
    </el-table>



  </div>
</template>

<script>
import axios from "axios";

export default {
  data() {
    return {

      orderList:{}
    }
  }, methods: {
    showOrder() {
      axios.get("/project/order/findByStatus").then(resp => {
        this.orderList = resp.data;
      })
    }, complete(id) {
      axios.get("/project/order/complete",{params:{id}}).then(resp=>{
        if (resp.data=="ok"){
          this.showOrder();
        }
      })
    }
  }, created() {
    this.showOrder();
  }
}
</script>

<style scoped>
.el-row {
  margin: 20px;
}
</style>